package com.si.control.action;

import java.awt.image.BufferedImage;
import java.util.List;

import javax.swing.JOptionPane;

import com.si.ui.enumn.EConstant;

public abstract class CollageAction implements IAction<List<BufferedImage>, BufferedImage> {
	
	protected int width;
	protected int height;
	
	protected CollageAction() {
		this.width = EConstant.PreviewSize.getValue();
		this.height = EConstant.PreviewSize.getValue();
	}

	@Override
	public BufferedImage perform(final List<BufferedImage> argument) throws Exception {
		if(argument == null || argument.size() <= 0) {
			JOptionPane.showMessageDialog(null, "No images to collage.");
			return null;
		}
		return this.doCollage(argument);
	}
	
	protected abstract BufferedImage doCollage(final List<BufferedImage> argument) throws Exception;
	
	public void setWidth(final int width) {
		this.width = width;
	}
	
	public void setHeight(final int height) {
		this.height = height;
	}
}
